import Vue from 'vue'
import App from './App.vue'
// 三级联动组件---全局组件
import TypeNav from '@/components/TypeNav/TypeNav.vue'
Vue.component(TypeNav.name, TypeNav)
import Carousel from '@/components/Carousel/Carousel.vue'
Vue.component(Carousel.name, Carousel)
// 分页器
import Pagination from "@/components/Pagination/Pagination.vue"
Vue.component(Pagination.name, Pagination)

// 引入swiper样式
import 'swiper/css'

// 引入MockServer.js-----mock数据
import "@/mock/mockServe.js"

// 引入路由
import router from '@/router'

// 引入vuex的store
import store from '@/store/store.js'

Vue.config.productionTip = false

import {
  Button , MessageBox } from 'element-ui';
Vue.component(Button.name, Button);

// 引入插件
import VueLazyload from 'vue-lazyload'
import dongtu from "@/assets/1.gif"
Vue.use(VueLazyload, {
  loading: dongtu
})

// 统一接收api文件里的全部请求函数
import * as API from "@/api/index"

Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

// w引入校验插件
import "@/plugins/validate"
new Vue({
  render: h => h(App),
  // 全局事件总线
  beforeCreate() {
    Vue.prototype.$bus = this;
    Vue.prototype.$API = API;
  },
  // 注册路由
  router,
  // 注册仓库：组件实例的身上会多一个实例$store属性
  store
}).$mount('#app')
